package org.sdau.rotten.library.exception;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class HandlerException {

    /*@ExceptionHandler(Exception.class)
    @ResponseBody
    public JsonData handlerException(Exception e){
        if(e instanceof AppointException){
            AppointException appointException=(AppointException)e;
            log.info("customerError:{}",((AppointException) e).getMsg());
            return JsonData.buildError(appointException.getMsg(),appointException.getCode());
        }
        else if (e instanceof NoBookException){
            NoBookException noBookException = (NoBookException) e;
            log.info("customerError:{}",((NoBookException) e).getMsg());
            return JsonData.buildError(noBookException.getMsg(), noBookException.getCode());
        }
        else if (e instanceof NoNumberException){
            NoNumberException noNumberException = (NoNumberException)e;
            log.info("customerError:{}",((NoNumberException) e).getMsg());
            return JsonData.buildError(noNumberException.getMsg(), noNumberException.getCode());
        }
        else if (e instanceof  RepeatAppointException){
            RepeatAppointException repeatAppointException = (RepeatAppointException) e;
            log.info("customError:{}",((RepeatAppointException)e).getMsg());
            return JsonData.buildError(repeatAppointException.getMsg(), repeatAppointException.getCode());
        }
            else{
            log.error("error:{}",e.getMessage());
            return JsonData.buildError("未知异常，联系管理员");
        }
    }*/
}
